package wiki.zimo.domain;


import wiki.zimo.annotation.Column;
import wiki.zimo.annotation.ID;
import wiki.zimo.annotation.Keyword;
import wiki.zimo.annotation.Table;

import java.sql.Timestamp;
import java.util.Objects;

/**
 * @auther: 子墨
 * @datetime: 2018/11/7 12:37
 * @describe: 商品实体类
 */
@Table(value = "product")
public class Product {

    @ID(value = "pid")
    private String pid;

    @Column(value = "cid")
    private String cid;

    @Column(value = "pname")
    @Keyword
    private String pname;

    @Column(value = "market_price")
    private double market_price;

    @Column(value = "shop_price")
    private double shop_price;

    @Column(value = "pimage")
    private String pimage;

    @Column(value = "pdate")
    private Timestamp pdate;

    @Column(value = "pbrowse")
    private long pbrowse;

    @Column(value = "pdesc")
    @Keyword
    private String pdesc;

    @Column(value = "pflag")
    private long pflag;

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public String getPname() {
        return pname;
    }

    public void setPname(String pname) {
        this.pname = pname;
    }

    public double getMarket_price() {
        return market_price;
    }

    public void setMarket_price(double market_price) {
        this.market_price = market_price;
    }

    public double getShop_price() {
        return shop_price;
    }

    public void setShop_price(double shop_price) {
        this.shop_price = shop_price;
    }

    public String getPimage() {
        return pimage;
    }

    public void setPimage(String pimage) {
        this.pimage = pimage;
    }

    public Timestamp getPdate() {
        return pdate;
    }

    public void setPdate(Timestamp pdate) {
        this.pdate = pdate;
    }

    public long getPbrowse() {
        return pbrowse;
    }

    public void setPbrowse(long pbrowse) {
        this.pbrowse = pbrowse;
    }

    public String getPdesc() {
        return pdesc;
    }

    public void setPdesc(String pdesc) {
        this.pdesc = pdesc;
    }

    public long getPflag() {
        return pflag;
    }

    public void setPflag(long pflag) {
        this.pflag = pflag;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return Double.compare(product.market_price, market_price) == 0 &&
                Double.compare(product.shop_price, shop_price) == 0 &&
                pbrowse == product.pbrowse &&
                pflag == product.pflag &&
                Objects.equals(pid, product.pid) &&
                Objects.equals(cid, product.cid) &&
                Objects.equals(pname, product.pname) &&
                Objects.equals(pimage, product.pimage) &&
                Objects.equals(pdate, product.pdate) &&
                Objects.equals(pdesc, product.pdesc);
    }

    @Override
    public int hashCode() {

        return Objects.hash(pid, cid, pname, market_price, shop_price, pimage, pdate, pbrowse, pdesc, pflag);
    }

    @Override
    public String toString() {
        return "Product{" +
                "pid='" + pid + '\'' +
                ", cid='" + cid + '\'' +
                ", pname='" + pname + '\'' +
                ", market_price=" + market_price +
                ", shop_price=" + shop_price +
                ", pimage='" + pimage + '\'' +
                ", pdate=" + pdate +
                ", pbrowse=" + pbrowse +
                ", pdesc='" + pdesc + '\'' +
                ", pflag=" + pflag +
                '}';
    }
}
